package com.distributed.kv.dto;

/**
 * 统计信息响应对象
 */
public class StatisticsResponse {

    private CacheStatistics cacheStats;
    private IdGeneratorStats idGeneratorStats;
    private SystemStats systemStats;

    public StatisticsResponse() {
    }

    public CacheStatistics getCacheStats() {
        return cacheStats;
    }

    public void setCacheStats(CacheStatistics cacheStats) {
        this.cacheStats = cacheStats;
    }

    public IdGeneratorStats getIdGeneratorStats() {
        return idGeneratorStats;
    }

    public void setIdGeneratorStats(IdGeneratorStats idGeneratorStats) {
        this.idGeneratorStats = idGeneratorStats;
    }

    public SystemStats getSystemStats() {
        return systemStats;
    }

    public void setSystemStats(SystemStats systemStats) {
        this.systemStats = systemStats;
    }

    public static class CacheStatistics {
        private long size;
        private long hitCount;
        private long missCount;
        private double hitRate;
        private long evictionCount;

        public CacheStatistics() {
        }

        public CacheStatistics(long size, long hitCount, long missCount, double hitRate, long evictionCount) {
            this.size = size;
            this.hitCount = hitCount;
            this.missCount = missCount;
            this.hitRate = hitRate;
            this.evictionCount = evictionCount;
        }

        public long getSize() {
            return size;
        }

        public void setSize(long size) {
            this.size = size;
        }

        public long getHitCount() {
            return hitCount;
        }

        public void setHitCount(long hitCount) {
            this.hitCount = hitCount;
        }

        public long getMissCount() {
            return missCount;
        }

        public void setMissCount(long missCount) {
            this.missCount = missCount;
        }

        public double getHitRate() {
            return hitRate;
        }

        public void setHitRate(double hitRate) {
            this.hitRate = hitRate;
        }

        public long getEvictionCount() {
            return evictionCount;
        }

        public void setEvictionCount(long evictionCount) {
            this.evictionCount = evictionCount;
        }
    }

    public static class IdGeneratorStats {
        private String instanceKey;
        private Long currentId;
        private Long maxId;
        private Long remainingIds;
        private boolean hasNextSegment;

        public IdGeneratorStats() {
        }

        public String getInstanceKey() {
            return instanceKey;
        }

        public void setInstanceKey(String instanceKey) {
            this.instanceKey = instanceKey;
        }

        public Long getCurrentId() {
            return currentId;
        }

        public void setCurrentId(Long currentId) {
            this.currentId = currentId;
        }

        public Long getMaxId() {
            return maxId;
        }

        public void setMaxId(Long maxId) {
            this.maxId = maxId;
        }

        public Long getRemainingIds() {
            return remainingIds;
        }

        public void setRemainingIds(Long remainingIds) {
            this.remainingIds = remainingIds;
        }

        public boolean isHasNextSegment() {
            return hasNextSegment;
        }

        public void setHasNextSegment(boolean hasNextSegment) {
            this.hasNextSegment = hasNextSegment;
        }
    }

    public static class SystemStats {
        private long totalMemoryMB;
        private long usedMemoryMB;
        private long freeMemoryMB;
        private double cpuUsage;
        private int activeThreads;
        private long upTimeSeconds;

        public SystemStats() {
        }

        public long getTotalMemoryMB() {
            return totalMemoryMB;
        }

        public void setTotalMemoryMB(long totalMemoryMB) {
            this.totalMemoryMB = totalMemoryMB;
        }

        public long getUsedMemoryMB() {
            return usedMemoryMB;
        }

        public void setUsedMemoryMB(long usedMemoryMB) {
            this.usedMemoryMB = usedMemoryMB;
        }

        public long getFreeMemoryMB() {
            return freeMemoryMB;
        }

        public void setFreeMemoryMB(long freeMemoryMB) {
            this.freeMemoryMB = freeMemoryMB;
        }

        public double getCpuUsage() {
            return cpuUsage;
        }

        public void setCpuUsage(double cpuUsage) {
            this.cpuUsage = cpuUsage;
        }

        public int getActiveThreads() {
            return activeThreads;
        }

        public void setActiveThreads(int activeThreads) {
            this.activeThreads = activeThreads;
        }

        public long getUpTimeSeconds() {
            return upTimeSeconds;
        }

        public void setUpTimeSeconds(long upTimeSeconds) {
            this.upTimeSeconds = upTimeSeconds;
        }
    }
}
